package com.design.mediator.smartcontrol;

// 中介者接口
interface SmartHomeMediator {
    void turnOffLights();
    void adjustTemperature();
    void turnOffSoundSystem();
}

// 智能设备类
class SmartLight {
    private SmartHomeMediator mediator;

    public SmartLight(SmartHomeMediator mediator) {
        this.mediator = mediator;
    }

    public void turnOff() {
        System.out.println("Smart light turned off.");
    }
}

class SmartThermostat {
    private SmartHomeMediator mediator;

    public SmartThermostat(SmartHomeMediator mediator) {
        this.mediator = mediator;
    }

    public void setTemperature(int temperature) {
        System.out.println("Temperature set to " + temperature + "°C.");
    }
}

class SmartSoundSystem {
    private SmartHomeMediator mediator;

    public SmartSoundSystem(SmartHomeMediator mediator) {
        this.mediator = mediator;
    }

    public void turnOff() {
        System.out.println("Sound system turned off.");
    }
}
